package com.hngates.architecture.service.impl;

import java.util.List;
import com.hngates.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hngates.architecture.mapper.ArcConstructContractMapper;
import com.hngates.architecture.domain.ArcConstructContract;
import com.hngates.architecture.service.IArcConstructContractService;
import com.hngates.common.core.text.Convert;

/**
 * 施工合同Service业务层处理
 * 
 * @author jwhe
 * @date 2022-07-04
 */
@Service
public class ArcConstructContractServiceImpl implements IArcConstructContractService 
{
    @Autowired
    private ArcConstructContractMapper arcConstructContractMapper;

    /**
     * 查询施工合同
     * 
     * @param id 施工合同主键
     * @return 施工合同
     */
    @Override
    public ArcConstructContract selectArcConstructContractById(Long id)
    {
        return arcConstructContractMapper.selectArcConstructContractById(id);
    }

    /**
     * 查询施工合同列表
     * 
     * @param arcConstructContract 施工合同
     * @return 施工合同
     */
    @Override
    public List<ArcConstructContract> selectArcConstructContractList(ArcConstructContract arcConstructContract)
    {
        return arcConstructContractMapper.selectArcConstructContractList(arcConstructContract);
    }

    /**
     * 新增施工合同
     * 
     * @param arcConstructContract 施工合同
     * @return 结果
     */
    @Override
    public int insertArcConstructContract(ArcConstructContract arcConstructContract)
    {
        arcConstructContract.setCreateTime(DateUtils.getNowDate());
        return arcConstructContractMapper.insertArcConstructContract(arcConstructContract);
    }

    /**
     * 修改施工合同
     * 
     * @param arcConstructContract 施工合同
     * @return 结果
     */
    @Override
    public int updateArcConstructContract(ArcConstructContract arcConstructContract)
    {
        arcConstructContract.setUpdateTime(DateUtils.getNowDate());
        return arcConstructContractMapper.updateArcConstructContract(arcConstructContract);
    }

    /**
     * 批量删除施工合同
     * 
     * @param ids 需要删除的施工合同主键
     * @return 结果
     */
    @Override
    public int deleteArcConstructContractByIds(String ids)
    {
        return arcConstructContractMapper.deleteArcConstructContractByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除施工合同信息
     * 
     * @param id 施工合同主键
     * @return 结果
     */
    @Override
    public int deleteArcConstructContractById(Long id)
    {
        return arcConstructContractMapper.deleteArcConstructContractById(id);
    }

    @Override
    public ArcConstructContract selectArcConstructContractById(Long projectId, Long builderCompanyId, Long labourCompanyId) {
        return arcConstructContractMapper.selectArcConstructContractByIds(projectId,builderCompanyId,labourCompanyId);
    }
}
